Integrand size = 23, antiderivative size = 138 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=-\frac {x}{a^3}+\frac {\left (3 a^2+12 a b+8 b^2\right ) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{8 a^3 \sqrt {b} (a+b)^{3/2} f}+\frac {\tan (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )^2}+\frac {(3 a+4 b) \tan (e+f x)}{8 a^2 (a+b) f \left (a+b+b \tan ^2(e+f x)\right )} \]
[Out]
Time = 0.28 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.304, Rules used = {4226, 2000, 482, 541, 536, 209, 211} \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=-\frac {x}{a^3}+\frac {(3 a+4 b) \tan (e+f x)}{8 a^2 f (a+b) \left (a+b \tan ^2(e+f x)+b\right )}+\frac {\left (3 a^2+12 a b+8 b^2\right ) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{8 a^3 \sqrt {b} f (a+b)^{3/2}}+\frac {\tan (e+f x)}{4 a f \left (a+b \tan ^2(e+f x)+b\right )^2} \]
[In]
[Out]
Rule 209
Rule 211
Rule 482
Rule 536
Rule 541
Rule 2000
Rule 4226
Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right ) \left (a+b \left (1+x^2\right )\right )^3} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\text {Subst}\left (\int \frac {x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {\tan (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )^2}-\frac {\text {Subst}\left (\int \frac {1-3 x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{4 a f} \\ & = \frac {\tan (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )^2}+\frac {(3 a+4 b) \tan (e+f x)}{8 a^2 (a+b) f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {\text {Subst}\left (\int \frac {5 a+4 b+(-3 a-4 b) x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{8 a^2 (a+b) f} \\ & = \frac {\tan (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )^2}+\frac {(3 a+4 b) \tan (e+f x)}{8 a^2 (a+b) f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {\text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{a^3 f}+\frac {\left (3 a^2+12 a b+8 b^2\right ) \text {Subst}\left (\int \frac {1}{a+b+b x^2} \, dx,x,\tan (e+f x)\right )}{8 a^3 (a+b) f} \\ & = -\frac {x}{a^3}+\frac {\left (3 a^2+12 a b+8 b^2\right ) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{8 a^3 \sqrt {b} (a+b)^{3/2} f}+\frac {\tan (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )^2}+\frac {(3 a+4 b) \tan (e+f x)}{8 a^2 (a+b) f \left (a+b+b \tan ^2(e+f x)\right )} \\ \end{align*}
Result contains complex when optimal does not.
Time = 13.27 (sec) , antiderivative size = 1473, normalized size of antiderivative = 10.67 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\frac {(a+2 b+a \cos (2 e+2 f x))^3 \sec ^6(e+f x) \left (\frac {\left (3 a^2+8 a b+8 b^2\right ) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{(a+b)^{5/2}}-\frac {a \sqrt {b} \left (3 a^2+16 a b+16 b^2+3 a (a+2 b) \cos (2 (e+f x))\right ) \sin (2 (e+f x))}{(a+b)^2 (a+2 b+a \cos (2 (e+f x)))^2}\right )}{1024 b^{5/2} f \left (a+b \sec ^2(e+f x)\right )^3}+\frac {(a+2 b+a \cos (2 e+2 f x))^3 \sec ^6(e+f x) \left (-\frac {3 a (a+2 b) \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{(a+b)^{5/2}}+\frac {\sqrt {b} \left (3 a^3+14 a^2 b+24 a b^2+16 b^3+a \left (3 a^2+4 a b+4 b^2\right ) \cos (2 (e+f x))\right ) \sin (2 (e+f x))}{(a+b)^2 (a+2 b+a \cos (2 (e+f x)))^2}\right )}{2048 b^{5/2} f \left (a+b \sec ^2(e+f x)\right )^3}-\frac {(a+2 b+a \cos (2 e+2 f x))^3 \sec ^6(e+f x) \left (\frac {2 \left (3 a^5-10 a^4 b+80 a^3 b^2+480 a^2 b^3+640 a b^4+256 b^5\right ) \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {\sec (2 e) \left (256 b^2 (a+b)^2 \left (3 a^2+8 a b+8 b^2\right ) f x \cos (2 e)+512 a b^2 (a+b)^2 (a+2 b) f x \cos (2 f x)+128 a^4 b^2 f x \cos (2 (e+2 f x))+256 a^3 b^3 f x \cos (2 (e+2 f x))+128 a^2 b^4 f x \cos (2 (e+2 f x))+512 a^4 b^2 f x \cos (4 e+2 f x)+2048 a^3 b^3 f x \cos (4 e+2 f x)+2560 a^2 b^4 f x \cos (4 e+2 f x)+1024 a b^5 f x \cos (4 e+2 f x)+128 a^4 b^2 f x \cos (6 e+4 f x)+256 a^3 b^3 f x \cos (6 e+4 f x)+128 a^2 b^4 f x \cos (6 e+4 f x)-9 a^6 \sin (2 e)+12 a^5 b \sin (2 e)+684 a^4 b^2 \sin (2 e)+2880 a^3 b^3 \sin (2 e)+5280 a^2 b^4 \sin (2 e)+4608 a b^5 \sin (2 e)+1536 b^6 \sin (2 e)+9 a^6 \sin (2 f x)-14 a^5 b \sin (2 f x)-608 a^4 b^2 \sin (2 f x)-2112 a^3 b^3 \sin (2 f x)-2560 a^2 b^4 \sin (2 f x)-1024 a b^5 \sin (2 f x)+3 a^6 \sin (2 (e+2 f x))-12 a^5 b \sin (2 (e+2 f x))-204 a^4 b^2 \sin (2 (e+2 f x))-384 a^3 b^3 \sin (2 (e+2 f x))-192 a^2 b^4 \sin (2 (e+2 f x))-3 a^6 \sin (4 e+2 f x)+10 a^5 b \sin (4 e+2 f x)+304 a^4 b^2 \sin (4 e+2 f x)+1056 a^3 b^3 \sin (4 e+2 f x)+1280 a^2 b^4 \sin (4 e+2 f x)+512 a b^5 \sin (4 e+2 f x)\right )}{(a+2 b+a \cos (2 (e+f x)))^2}\right )}{4096 a^3 b^2 (a+b)^2 f \left (a+b \sec ^2(e+f x)\right )^3}-\frac {(a+2 b+a \cos (2 e+2 f x))^3 \sec ^6(e+f x) \left (-\frac {6 a^2 \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {a \sec (2 e) \left (\left (-9 a^4-16 a^3 b+48 a^2 b^2+128 a b^3+64 b^4\right ) \sin (2 f x)+a \left (-3 a^3+2 a^2 b+24 a b^2+16 b^3\right ) \sin (2 (e+2 f x))+\left (3 a^4-64 a^2 b^2-128 a b^3-64 b^4\right ) \sin (4 e+2 f x)\right )+\left (9 a^5+18 a^4 b-64 a^3 b^2-256 a^2 b^3-320 a b^4-128 b^5\right ) \tan (2 e)}{a^2 (a+2 b+a \cos (2 (e+f x)))^2}\right )}{2048 b^2 (a+b)^2 f \left (a+b \sec ^2(e+f x)\right )^3} \]
[In]
[Out]
Time = 11.63 (sec) , antiderivative size = 125, normalized size of antiderivative = 0.91
method | result | size |
derivativedivides | \(\frac {-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a^{3}}+\frac {\frac {\frac {a b \left (3 a +4 b \right ) \tan \left (f x +e \right )^{3}}{8 a +8 b}+\frac {\left (5 a +4 b \right ) a \tan \left (f x +e \right )}{8}}{\left (a +b +b \tan \left (f x +e \right )^{2}\right )^{2}}+\frac {\left (3 a^{2}+12 a b +8 b^{2}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{8 \left (a +b \right ) \sqrt {\left (a +b \right ) b}}}{a^{3}}}{f}\) | \(125\) |
default | \(\frac {-\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a^{3}}+\frac {\frac {\frac {a b \left (3 a +4 b \right ) \tan \left (f x +e \right )^{3}}{8 a +8 b}+\frac {\left (5 a +4 b \right ) a \tan \left (f x +e \right )}{8}}{\left (a +b +b \tan \left (f x +e \right )^{2}\right )^{2}}+\frac {\left (3 a^{2}+12 a b +8 b^{2}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{8 \left (a +b \right ) \sqrt {\left (a +b \right ) b}}}{a^{3}}}{f}\) | \(125\) |
risch | \(-\frac {x}{a^{3}}+\frac {i \left (5 a^{3} {\mathrm e}^{6 i \left (f x +e \right )}+20 a^{2} b \,{\mathrm e}^{6 i \left (f x +e \right )}+16 a \,b^{2} {\mathrm e}^{6 i \left (f x +e \right )}+15 a^{3} {\mathrm e}^{4 i \left (f x +e \right )}+58 a^{2} b \,{\mathrm e}^{4 i \left (f x +e \right )}+88 a \,b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+48 b^{3} {\mathrm e}^{4 i \left (f x +e \right )}+15 a^{3} {\mathrm e}^{2 i \left (f x +e \right )}+44 a^{2} b \,{\mathrm e}^{2 i \left (f x +e \right )}+32 a \,b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+5 a^{3}+6 a^{2} b \right )}{4 a^{3} \left (a +b \right ) f \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a \right )^{2}}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {-2 i b a -2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right )}{16 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f a}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {-2 i b a -2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right ) b}{4 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f \,a^{2}}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {-2 i b a -2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right ) b^{2}}{2 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f \,a^{3}}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i b a +2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right )}{16 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f a}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i b a +2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right ) b}{4 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f \,a^{2}}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i b a +2 i b^{2}+a \sqrt {-a b -b^{2}}+2 b \sqrt {-a b -b^{2}}}{a \sqrt {-a b -b^{2}}}\right ) b^{2}}{2 \sqrt {-a b -b^{2}}\, \left (a +b \right ) f \,a^{3}}\) | \(785\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 390 vs. \(2 (124) = 248\).
Time = 0.33 (sec) , antiderivative size = 860, normalized size of antiderivative = 6.23 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\left [-\frac {32 \, {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f x \cos \left (f x + e\right )^{4} + 64 \, {\left (a^{3} b^{2} + 2 \, a^{2} b^{3} + a b^{4}\right )} f x \cos \left (f x + e\right )^{2} + 32 \, {\left (a^{2} b^{3} + 2 \, a b^{4} + b^{5}\right )} f x + {\left ({\left (3 \, a^{4} + 12 \, a^{3} b + 8 \, a^{2} b^{2}\right )} \cos \left (f x + e\right )^{4} + 3 \, a^{2} b^{2} + 12 \, a b^{3} + 8 \, b^{4} + 2 \, {\left (3 \, a^{3} b + 12 \, a^{2} b^{2} + 8 \, a b^{3}\right )} \cos \left (f x + e\right )^{2}\right )} \sqrt {-a b - b^{2}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{3} - b \cos \left (f x + e\right )\right )} \sqrt {-a b - b^{2}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) - 4 \, {\left ({\left (5 \, a^{4} b + 11 \, a^{3} b^{2} + 6 \, a^{2} b^{3}\right )} \cos \left (f x + e\right )^{3} + {\left (3 \, a^{3} b^{2} + 7 \, a^{2} b^{3} + 4 \, a b^{4}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{32 \, {\left ({\left (a^{7} b + 2 \, a^{6} b^{2} + a^{5} b^{3}\right )} f \cos \left (f x + e\right )^{4} + 2 \, {\left (a^{6} b^{2} + 2 \, a^{5} b^{3} + a^{4} b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{5} b^{3} + 2 \, a^{4} b^{4} + a^{3} b^{5}\right )} f\right )}}, -\frac {16 \, {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} f x \cos \left (f x + e\right )^{4} + 32 \, {\left (a^{3} b^{2} + 2 \, a^{2} b^{3} + a b^{4}\right )} f x \cos \left (f x + e\right )^{2} + 16 \, {\left (a^{2} b^{3} + 2 \, a b^{4} + b^{5}\right )} f x + {\left ({\left (3 \, a^{4} + 12 \, a^{3} b + 8 \, a^{2} b^{2}\right )} \cos \left (f x + e\right )^{4} + 3 \, a^{2} b^{2} + 12 \, a b^{3} + 8 \, b^{4} + 2 \, {\left (3 \, a^{3} b + 12 \, a^{2} b^{2} + 8 \, a b^{3}\right )} \cos \left (f x + e\right )^{2}\right )} \sqrt {a b + b^{2}} \arctan \left (\frac {{\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b}{2 \, \sqrt {a b + b^{2}} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) - 2 \, {\left ({\left (5 \, a^{4} b + 11 \, a^{3} b^{2} + 6 \, a^{2} b^{3}\right )} \cos \left (f x + e\right )^{3} + {\left (3 \, a^{3} b^{2} + 7 \, a^{2} b^{3} + 4 \, a b^{4}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{16 \, {\left ({\left (a^{7} b + 2 \, a^{6} b^{2} + a^{5} b^{3}\right )} f \cos \left (f x + e\right )^{4} + 2 \, {\left (a^{6} b^{2} + 2 \, a^{5} b^{3} + a^{4} b^{4}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{5} b^{3} + 2 \, a^{4} b^{4} + a^{3} b^{5}\right )} f\right )}}\right ] \]
[In]
[Out]
\[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\int \frac {\tan ^{2}{\left (e + f x \right )}}{\left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{3}}\, dx \]
[In]
[Out]
none
Time = 0.27 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.38 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\frac {\frac {{\left (3 \, a^{2} + 12 \, a b + 8 \, b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{{\left (a^{4} + a^{3} b\right )} \sqrt {{\left (a + b\right )} b}} + \frac {{\left (3 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )^{3} + {\left (5 \, a^{2} + 9 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )}{a^{5} + 3 \, a^{4} b + 3 \, a^{3} b^{2} + a^{2} b^{3} + {\left (a^{3} b^{2} + a^{2} b^{3}\right )} \tan \left (f x + e\right )^{4} + 2 \, {\left (a^{4} b + 2 \, a^{3} b^{2} + a^{2} b^{3}\right )} \tan \left (f x + e\right )^{2}} - \frac {8 \, {\left (f x + e\right )}}{a^{3}}}{8 \, f} \]
[In]
[Out]
none
Time = 0.74 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.25 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\frac {\frac {{\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )} {\left (3 \, a^{2} + 12 \, a b + 8 \, b^{2}\right )}}{{\left (a^{4} + a^{3} b\right )} \sqrt {a b + b^{2}}} + \frac {3 \, a b \tan \left (f x + e\right )^{3} + 4 \, b^{2} \tan \left (f x + e\right )^{3} + 5 \, a^{2} \tan \left (f x + e\right ) + 9 \, a b \tan \left (f x + e\right ) + 4 \, b^{2} \tan \left (f x + e\right )}{{\left (a^{3} + a^{2} b\right )} {\left (b \tan \left (f x + e\right )^{2} + a + b\right )}^{2}} - \frac {8 \, {\left (f x + e\right )}}{a^{3}}}{8 \, f} \]
[In]
[Out]
Time = 22.82 (sec) , antiderivative size = 2405, normalized size of antiderivative = 17.43 \[ \int \frac {\tan ^2(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^3} \, dx=\text {Too large to display} \]
[In]
[Out]